#include <stdio.h>

int main(int argc, char *argv[])
{
    int i, j, k, a[3], b[3], c[3], x, y, z, cnt;
    
    cnt = 0;
    for (i = 123; i < 398; i++) {
        a[0] = i%10;
        a[1] = (i%100)/10;
        a[2] = i/100;
        if (a[0] == 0 || a[0] == a[1] || a[0] == a[2] || 
            a[1] == 0 || a[1] == a[2])
                continue;
       
        j = i+i;
        b[0] = j%10;
        b[1] = (j%100)/10;
        b[2] = j/100;
        if (b[0] == 0 || b[0] == b[1] || b[0] == b[2] || 
            b[1] == 0 || b[1] == b[2])
            continue;

        for (x = 0; x < 3; x++) {
            for (y = 0; y < 3; y++) {
                if (b[x] == a[y])
                    goto cont;
            }
        }

        k = i+i+i;
        c[0] = k%10;
        c[1] = (k%100)/10;
        c[2] = k/100;
        if (c[0] == 0 || c[0] == c[1] || c[0] == c[2] || 
            c[1] == 0 || c[1] == c[2])
            continue;

        for (x = 0; x < 3; x++) {
            for (y = 0; y < 3; y++) {
                for (z = 0; z < 3; z++) {
                    if (c[x] == a[z] || c[x] == b[y])
                        goto cont;
                }
            }
        }

        printf("%d, %d, %d\n", i, j, k);
        cnt ++;
cont:
        continue;
    }
    
    printf("total %d\n", cnt);

    return 0;
}
